<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html>
<html>
<head>

<link rel='SHORTCUT ICON' href='<s:url value="/theme/img/carepad.png" />' />

<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="description" content="Axiohelix CarePAD" />
<meta name="keywords" content="Axiohelix, Home Electronics" />
<meta name="author" content="Axiohelix" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />

<link href="<s:url value='/theme/css/bootstrap.min.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/bootstrap-responsive.min.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/bootstrap-timepicker.min.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/jquery-ui.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/contextMenu.css'/>" rel="stylesheet">
<link href="<s:url value='/theme/css/jquery.sliderTabs.css' />"	rel="stylesheet" />
<link href="<s:url value='/theme/css/table.css'/>" rel="stylesheet">
<link href="<s:url value='/theme/css/mobiscroll.core-2.6.2.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/mobiscroll.sense-ui-2.6.2.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/jquery.icheck.custom.css' />" rel="stylesheet">
<link href="<s:url value='/theme/css/jquery.jqplot.min.css' />" rel="stylesheet" />
<link href="<s:url value='/theme/css/style.css' />" rel="stylesheet" />

<script src="<s:url value='/theme/js/jquery-1.10.2.js'/>"></script>
<script src="<s:url value='/theme/js/bootstrap.min.js'/>"></script>
<script src="<s:url value='/theme/js/bootstrap-timepicker.min.js'/>"></script>
<script src="<s:url value='/theme/js/bootstrap-tab.js'/>"></script>
<script src="<s:url value='/theme/js/jquery-ui.js'/>"></script>
<script src="<s:url value='/theme/js/contextMenu.js'/>"></script>
<script src="<s:url value='/theme/js/jquery.storage.js'/>"></script>
<script src="<s:url value='/theme/js/jquery.sliderTabs.js'/>"></script>
<script src="<s:url value='/theme/js/mobiscroll.core-2.6.2.js'/>"></script>
<script src="<s:url value='/theme/js/mobiscroll.datetime-2.6.2.js'/>"></script>
<script src="<s:url value='/theme/js/jquery.icheck.min.js'/>"></script>
<script src="<s:url value='/theme/js/jquery.jqplot.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.highlighter.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.cursor.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.pointLabels.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.dateAxisRenderer.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.canvasTextRenderer.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/jqplot.canvasAxisTickRenderer.min.js'/>" type="text/javascript" ></script>
<script src="<s:url value='/theme/js/json2.js'/>"></script>

<script type="text/javascript">
	function checkSelectClient(event) {

		var selectedClient = '<s:property value="%{#session.CURRENT_PATIENT.hcsID}"/>';

		if (selectedClient == "" || selectedClient == null) {
			event.preventDefault();
			alert("<s:text name='global.message.select.client'/>");
			$('#txtSearchClient').focus();
		}
	}
	
	var vital0max = parseInt("<s:text name='input.BPH.Max.Value'/>");
	var vital0min = parseInt("<s:text name='input.BPH.Min.Value'/>");
	var vital0default = parseInt("<s:text name='input.BPH.Default.Value'/>");
	
	var vital1max = parseInt("<s:text name='input.BPL.Max.Value'/>");
	var vital1min = parseInt("<s:text name='input.BPL.Min.Value'/>");
	var vital1default = parseInt("<s:text name='input.BPL.Default.Value'/>");
	
	var vital2max = parseInt("<s:text name='input.PR.Max.Value'/>");
	var vital2min = parseInt("<s:text name='input.PR.Min.Value'/>");
	var vital2default = parseInt("<s:text name='input.PR.Default.Value'/>");
	
	var vital3max = parseInt("<s:text name='input.BT.Max.Value'/>");
	var vital3min = parseInt("<s:text name='input.BT.Min.Value'/>");
	var vital3default = parseInt("<s:text name='input.BT.Default.Value'/>");
	
	function incrementValue(id){			
		var max = 0;
		var def = 0;
		
		if (id=="#vital0"){
			max = vital0max;
			def = vital0default;
		} else if (id=="#vital1"){
			max = vital1max;
			def = vital1default;
		} else if (id=="#vital2"){
			max = vital2max;
			def = vital2default;
		} else if (id=="#vital3"){
			max = vital3max;
			def = vital3default;
		}
		
		if (id=="#vital3"){
			value = parseFloat($(id).val());
		} else {
			value = parseInt($(id).val());
		}
		
		if(isNaN(value)){
			value = def;			
		} 
		
		if(value < max){
			if(id=="#vital3"){
				$(id).val((value+0.1).toFixed(1));
			}
			else $(id).val(value+1);
		}
	}
	
	function decrementValue(id){
		var min = 0;
		var def = 0;
		
		if (id=="#vital0"){
			min = vital0min;
			def = vital0default;
		} else if (id=="#vital1"){
			min = vital1min;
			def = vital1default;
		} else if (id=="#vital2"){
			min = vital2min;
			def = vital2default;
		} else if (id=="#vital3"){
			min = vital3min;
			def = vital3default;
		}
		
		if (id=="#vital3"){
			value = parseFloat($(id).val());
		} else {
			value = parseInt($(id).val());
		}
		
		if(isNaN(value)){
			value = def;
		} 
		
		if(value > min){
			if(id=="#vital3"){
				$(id).val((value-0.1).toFixed(1));
			}
			else $(id).val(value-1);
		}
	}
	
	function getDefaultValue(id){
		var defaultValue = 0;
		
		if(id=="#vital0"){
			defaultValue = vital0default;
		} else if(id=="#vital1"){
			defaultValue = vital1default;
		} else if(id=="#vital2"){
			defaultValue = vital2default;
		} else if(id=="#vital3"){
			defaultValue = vital3default;
		}
	
		$(id).val(defaultValue);
	}
	
	$(document).ready(function() {

		$("#vital0").val(vital0default);
		$("#vital1").val(vital1default);
		$("#vital2").val(vital2default);
		$("#vital3").val(vital3default);
			
			
	});
</script>